// 2、通过实现Runnable接口的方式创建一个新线程，要求main线程打印100次“main”，新线程打印50次“new”。
class MyThread1 implements Runnable{
    @Override
    public void run() {
        System.out.println("新线程");
        for(int i = 0;i < 50;i++){
            System.out.println("new");
        }
    }
}
public class Demo2 {
    public static void main(String[] args) {
        Runnable runnable = new MyThread1();
        Thread thread = new Thread(runnable);
        thread.start();

        for(int i = 0;i < 100;i++){
            System.out.println("main");
        }
    }
}
